$(function () {
//声明变量
    var pro_dialog =  $("#pro_dialog");
    var pro_form = $("#pro_form");
    var pro_datagrid = $("#pro_datagrid");

    pro_datagrid.datagrid({
        url:'/productAnalysis/query.do',
        toolbar:"#btn",
        fit:true,
        fitColumns:true,
        rownumbers:true,
        pagination:true,
        singleSelect:true,
        columns:[[
            {field:'id',checkbox:true,hidden:true},
            {field:'product.name',title:'商品名称',width:80,formatter:function(value,row,index){
                return row ? row.product.name:'';
                }},
            {field:'product.costPrice',title:'商品单价',width:80,formatter:function (value,row,index) {
                    console.log(row);
                    return row ? row.product.costPrice:'';
                }},
            {field:'orderbillSn',title:'销售编码',width:80},
            {field:'accountSaleammount',title:'销售总金额',width:80},
            {field:'accountNum',title:'商品数量',width:80},
            {field:'remark',title:'备注',width:80},
            {field:'avdate',title:'销售时间',width:80,hidden:true}



        ]]
    });

    var methodObj = {

        query:function (){
            //获取查询条件
            var minTime = $("#minTime").datebox('getValue');
            var maxTime = $("#maxTime").datebox('getValue');

            pro_datagrid.datagrid('load',{//这个是数据表格,下面函数是获取数据表达的值
                minTime:minTime,
                maxTime:maxTime
            });

        }

    };
    //统一绑定事件:
    $("a[data-cmd]").click(function () {
        var methodname = $(this).data("cmd");
        //动态获取调用方法名字,调用方法;
        methodObj[methodname]();
    })
});


//删除

//编辑

//============表单的 按钮 保存/取消=================


//保存密码


//高级查询


//修改密码

